$('[x-upload="true"]').each(function($index,$htmlElement){
    var currentElement=$($htmlElement);
        currentElement.css('display','none');
    //~
    var postData={
        number:$index,
        sourceControlId:currentElement.attr('id'),
        data:currentElement.attr('x-data')
    };
    $.post(currentElement.attr('x-upload-ui'),postData,function(data){
        currentElement.after(data);
    });
});

if($('#x-upload-execute-error').length>=1){
    var data=$('#x-upload-execute-data').val().split(',');
    var sourceControl=$(parent.document.getElementById(data[0]));
    var errorPanel=$(parent.document.getElementById(data[1]));
    var fileControlName=$(parent.document.getElementById(data[3]));
    //~
    var filenameControl=$('#x-upload-execute-filename');
    //~
    if(filenameControl.val()===''){
        errorPanel.html($('#x-upload-execute-error').val());
        errorPanel.attr('class',errorPanel.attr('class').replace(/hidden/ig,''))
        errorPanel.show();
    }
    else{
        fileControlName.val(filenameControl.val());
        sourceControl.val($('#x-upload-execute-filename').val());
        errorPanel.html('');
        errorPanel.hide();
    }
}